package com.lagou.edu.service.impl;


import com.lagou.edu.dao.ResumeDAO;
import com.lagou.edu.model.entity.Resume;
import com.lagou.edu.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @program: stage_1_module_3
 * @description:
 * @author: zhangxiaoyang
 * @date: 2020-07-18 21:09
 **/
@Service
public class ResumeServiceImpl implements ResumeService {


    @Autowired
    private ResumeDAO resumeDAO;


    @Override
    public List<Resume> list() {
        List<Resume> resumeList = resumeDAO.findAll();
        return resumeList;
    }

    @Override
    public void save(Resume resume) {
        resumeDAO.save(resume);
    }

    @Override
    public Resume get(Long id) {
        Optional<Resume> resume = resumeDAO.findById(id);
        return resume.isPresent() ? resume.get() : null;
    }

    @Override
    public void delete(Long id) {
        resumeDAO.deleteById(id);
    }
}
